package operation.modules.workReport.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import operation.modules.workReport.dao.WorkDateDao;
import operation.modules.workReport.entity.WorkDateEntity;
import operation.modules.workReport.service.WorkDateService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("workDateService")
public class WorkDateServiceImpl extends ServiceImpl<WorkDateDao, WorkDateEntity> implements WorkDateService {
    private final Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * 查询数据库所有表
     */
    public List<WorkDateEntity> queryAll() {
        List<WorkDateEntity> allDataList = baseMapper.queryAll();
        System.out.println("查询结果:" + allDataList);
        return allDataList;
    }

    /**
     * 根据日期编号查询
     */
    public WorkDateEntity queryByCode(String code) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("code", code);
        return baseMapper.selectOne(queryWrapper);
    }

}
